home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Sample Code / Music Architecture / Embedding Instruments / BigEasy / BigEasyGestalt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-07  |  2.7 KB  |  127 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        BigEasyGestalt.c
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    xxx put writers here xxx
  7.  
  8.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>      1/7/93    dvb        More selectors.
  13.          <1>     1/20/92    dvb        first checked in
  14.  
  15. */
  16.  
  17. /* file: BigEasyGestalt.c
  18.  *
  19.  * Started 28 December 1991, more or less.
  20.  *
  21.  */
  22.  
  23.  
  24.  
  25. /*--------------------------
  26.     Inclusions
  27. --------------------------*/
  28.  
  29. #include <GestaltEqu.h>
  30.  
  31. #include "BigEasyDialogs.h"
  32.  
  33. #define BigEasyGestaltMe
  34. #include "BigEasyGestalt.h"
  35.  
  36. /*--------------------------
  37.     Constants
  38. --------------------------*/
  39. static EasyGestaltItem dKnownFeatureList[] =
  40.     {
  41.     'ppc ',0,0,"\pPPC Toolbox not installed. This feature is available in System 7.0 and later.",
  42.     'qdrw',0,0,"\pColor QuickDraw is not available.",
  43.     'qtim',0,0,"\pQuickTime is not installed. Please place the QuickTime extension in your System Folder.",
  44.     'icmp',0,0,"\pImage Compression is not installed. Please place the QuickTime extension in your System Folder.",
  45.     'cpnt',0,0,"\pComponent Manager is not installed. Please place the QuickTime extension in your System Folder.",
  46.     'fs  ',0xFFFFFFFF,0,"\pSystem 7.0 or later required.",
  47.     'fpu ',0xFFFFFFFF,0,"\pFloating Point Unit required. Sorry.",
  48.     'snd ',0x00000020,0,"\pThere is no sound input device on this Macintosh."
  49.     };
  50.  
  51. /*--------------------------
  52.     Roughage
  53. --------------------------*/
  54.  
  55. Boolean CheckEasyGestaltItem(EasyGestaltItem *egi)
  56. /*
  57.  * Returns true if its still okay to run.
  58.  */
  59.     {
  60.     OSErr thisError;
  61.     long gResult;
  62.     Boolean result;
  63.  
  64.     result = true;
  65.  
  66.     thisError = Gestalt(egi->type,&gResult);
  67.     if(!( (thisError == 0) && ( (egi->mask == 0) || ((gResult & egi->mask) != 0))))
  68.         {
  69.         if(egi->canRunWithout)
  70.             EasyDialogMessage(1,"\pRecommendation",egi->unpresentWarning,
  71.                     kEasyDialogOkay);
  72.         else
  73.             {
  74.             result = false;
  75.             EasyDialogMessage(2,"\pRequired Feature Missing",egi->unpresentWarning,
  76.                     kEasyDialogOkay);
  77.             }
  78.         }
  79.  
  80.     return result;
  81.     }
  82.  
  83. Boolean CheckEasyGestaltItemList(long count, EasyGestaltItem egiList[])
  84.     {
  85.     short i;
  86.     Boolean p,q;
  87.  
  88.     p = true;
  89.  
  90.     for(i = 0; i< count; i++)
  91.         {
  92.         q = CheckEasyGestaltItem(&egiList[i]);
  93.         p = p && q;
  94.         }
  95.  
  96.     return p;
  97.     }
  98.  
  99. Boolean CheckEasyGestaltKnownFeature(Boolean canRunWithout,long feature)
  100.     {
  101.     EasyGestaltItem *egi;
  102.  
  103.     if(feature < 0 || feature >= kLastEasyGestaltKnownFeature)
  104.         return false;
  105.  
  106.     egi = &dKnownFeatureList[feature];
  107.     egi->canRunWithout = canRunWithout;
  108.     return CheckEasyGestaltItem(egi);
  109.     }
  110.  
  111.  
  112. Boolean CheckEasyGestaltKnownFeatures(Boolean canRunWithout,
  113.         short count,long feature1,...)
  114.     {
  115.     long *featureWalker;
  116.     Boolean result;
  117.  
  118.     result = true;
  119.  
  120.     featureWalker = &feature1;
  121.     while(count--)
  122.         result &= CheckEasyGestaltKnownFeature(canRunWithout,*featureWalker++);
  123.  
  124.     return result;
  125.     }
  126.  
  127.